<?
include_once("../include/session.php");
include_once("../include/dbConnect.php");
if(ereg("countVisited.php",$_SERVER['PHP_SELF'])){
	header("location:../home/");
	exit();
}
if(!isset($_SESSION["count_visited"])){
	$_SESSION["count_visited"]=session_id();
	$update_count=mysql_query("UPDATE counter SET value=(value+1), date=NOW() ");
	$query_count=mysql_query("SELECT * FROM counter");
	$count=mysql_fetch_array($query_count);
}else{
	$query_count=mysql_query("SELECT * FROM counter");
	$count=mysql_fetch_array($query_count);
}
$count_value="0";
$length_count=strlen($count["value"]);
if($length_count<6)
{
	for($j=0;$j<5-$length_count;$j++)
	{
		$count_value.="0";
	}
		$count_value.=$count["value"];
		$_SESSION["count_value"]=$count_value;
}
echo "Visitor's counter  ".$_SESSION["count_value"];
?>
